#This module contains the spatial, temporal, and soil hydraulic parameters
import numpy as np 
pars_MZs = np.loadtxt('./relevant_data/Parameters_LSTM.txt')

def spatialVariables_1D_act():
    totalDepth      = 1.0    # in meters ('m')
    axialNodes      = 31
    totalNodes      = axialNodes
    return totalDepth, axialNodes, totalNodes

def temporalVariable():
    samplingTime   = 1*4*6*60*60
    samplingTimeInternal = 1*4*6*60*60
    simulationTime = 1*6*4*60*60
    internalTimeSteps = int(samplingTime/samplingTimeInternal)
    totTimeSteps   = int(simulationTime/samplingTime)
    return samplingTime, samplingTimeInternal, internalTimeSteps, totTimeSteps  

def temporal_discretization(_points):
    samplingTime   = 1*4*6*60*60
    samplingTimeInternal = (samplingTime/_points)
    simulationTime = 1*6*4*60*60
    internalTimeSteps = _points
    totalTimeSteps   = int(simulationTime/samplingTimeInternal)
    totalTimeSteps_daily = int(samplingTime/samplingTimeInternal)
    return samplingTime, samplingTimeInternal, internalTimeSteps, totalTimeSteps_daily, totalTimeSteps  

def ManagementZone_1(): # Loamy soil
    soilPars = {}
    soilPars['thetaR'] = 0.078
    soilPars['thetaS'] = 0.43
    soilPars['alpha']  = round(pars_MZs[0,2], 1)
    #soilPars['n']      = pars_MZs[0,3]
    soilPars['n']      = 1.56
    soilPars['m']      = 1-1/soilPars['n']
    soilPars['Ks']     = (round(pars_MZs[0,0], 2))/86400
    soilPars['neta']   = 0.5
    soilPars['Ss']     = 0.00001
    return soilPars

def ManagementZone_2(): #Loamy soil
    soilPars = {}
    soilPars['thetaR'] = 0.078
    soilPars['thetaS'] = 0.43
    soilPars['alpha']  = round(pars_MZs[1,2],1)
    #soilPars['n']      = pars_MZs[1,3]
    soilPars['n']      = 1.56
    soilPars['m']      = 1-1/soilPars['n']
    soilPars['Ks']     = (round(pars_MZs[1,0],2))/86400
    soilPars['neta']   = 0.5
    soilPars['Ss']     = 0.00001
    return soilPars

def ManagementZone_3(): #Sandy clay loam soil
    soilPars = {}
    soilPars['thetaR'] = 0.10
    soilPars['thetaS'] = 0.39
    soilPars['alpha']  = round(pars_MZs[2,2], 1)
    soilPars['n']      = round(pars_MZs[2,3], 2)
    soilPars['m']      = 1-1/soilPars['n']
    soilPars['Ks']     = (round(pars_MZs[2,0], 2))/86400
    soilPars['neta']   = 0.5
    soilPars['Ss']     = 0.00001
    return soilPars
